package wang.raye.springcloud.zuul;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.cloud.netflix.zuul.filters.RouteLocator;
import org.springframework.cloud.netflix.zuul.filters.ZuulProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import wang.raye.springcloud.zuul.service.ChannelService;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Raye on 2018-06-12
 */
@Configuration
public class ZuulConfiguration {

    @Autowired
    private HttpServletRequest request;
    @Autowired
    //zuul的配置文件,对应了application.properties中的配置信息
    protected ZuulProperties zuulProperties;

    @Autowired
    protected ServerProperties server;
    @Autowired
    private ChannelService service;

    @Bean
    public MyPreDecorationFilter myPreDecorationFilter(){
        return new MyPreDecorationFilter(server.getServletPrefix(),zuulProperties,service);
    }
}
